﻿using Abp.Domain.Repositories;
using Abp.Domain.Uow;
using Magicodes.Admin.WULINGAddresss;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Magicodes.Admin.SFOrders
{
    public class SFOrderManager
    {
        private readonly IRepository<SFOrder, long> _sfOrderRepository;
        private readonly WULINGAddressManager  _wULINGAddressManager;

        public SFOrderManager(IRepository<SFOrder, long>  sfOrderRepository,
            WULINGAddressManager  wULINGAddressManager)
        {
            _sfOrderRepository = sfOrderRepository;
            _wULINGAddressManager = wULINGAddressManager;
        }
         
        [UnitOfWork]
        public async Task Import(IEnumerable<SFOrder>  sFOrders)
        { 
            var adds = new List<SFOrder>(); 
            foreach (var item in sFOrders)
            {
                var wulintAddress = _wULINGAddressManager.GetByServiceStationCode(item.ServiceStationCode);
               
                adds.Add(item);

              await  _sfOrderRepository.InsertAsync(item);
            }
            
        }
    }
}
